import api  from '@/utils/request'
// 获取首页默认地址
export const getcate = () => api({
  url: 'api/getcate',
  method: 'GET',
})
export const getBanner = () => api({
  url: 'api/getbanner',
  method: 'GET',
 
})


export const getHortgoods = () => api(
{
  url: 'api/gethortgoods',
  method: 'GET',
 
})


export const getGoodsinfo = ({id}) => api({
  url: 'api/getgoodsinfo',
  method: 'GET',
  data:{
  	  id
  }
})


export const getSms = ({phone}) => api({
  url: 'api/sms',
  method: 'GET',
  data:{
	phone
  }
})


export const postCartadd = ({uid,goodsid,num}) => api({
  url: 'api/cartadd',
  method: 'POST',
  data:{
  	  uid,
	  goodsid,
	  num,
  }
})


export const smslogin = ({phone}) => api({
  url: 'api/smslogin',
  method: 'POST',
  data:{
	phone:phone
  }
})

export const checktoken = ({token}) => api({
  url: 'api/checktoken',
  method: 'GET',
  header:{
	  authorization:token
  }
})



export const getuserinfo = ({uid}) => api({
  url: 'api/getuserinfo',
  method: 'GET',
data:{
		 uid
}
	})
	
// 修改购物车


export const cartlist = ({uid}) => api({
  url: 'api/cartlist',
  method: 'GET',
  data:{
	uid
  }
})

export const cartedit = ({id,type}) => api({
  url: 'api/cartedit',
  method: 'POST',
  data:{
	type,id
  }
})


export const cartdelete = ({id}) => api({
  url: 'api/cartdelete',
  method: 'POST',
  data:{
	id
  }
})
export const addresslist = ({	uid,id=''}) => api({
  url: 'api/addresslist',
  method: 'GET',
  data:{
	uid,id,
  }
})

export const addressadd = ({
	location,userphone,useraddress,username,
		status,uid
	
}=data) => api({
  url: 'api/addressadd',
  method: 'POST',
  data:{
	  location,userphone,useraddress,username,
	  	status,uid
  }
})



export const addressedit = (data) => api({
  url: 'api/addressedit',
  method: 'POST',
  data
})




export const addressremove = ({id}) => api({
  url: 'api/addressremove',
  method: 'POST',
  data:{
	  id
  }
})



export const orderadd = (data) => api({
  url: 'api/orderadd',
  method: 'POST',
  data
})

export const alipay = (data) => api({
  url: 'api/alipay',
  method: 'POST',
  data
})



export const orderlist = (data) => api({
  url: 'api/orderlist',
  method: 'GET',
  data,


})

 // 编辑

export const infoedit = (data) => api({
  url: 'api/infoedit',
  method: 'POST',
  data,
  

})